//
//  QuickaboutClinicalTimeTableViewCell.m
//  WE
//
//  Created by 要帅气的生活 on 15/11/21.
//  Copyright © 2015年 UNOHACHA. All rights reserved.
//

#import "QuickaboutClinicalTimeTableViewCell.h"
#import "BaseView.h"
#import "DatPpickerViewController.h"
#import "SingletonStoreSimpleData.h"
@interface QuickaboutClinicalTimeTableViewCell ()

@property (nonatomic,strong) SingletonStoreSimpleData *sing;

@end

@implementation QuickaboutClinicalTimeTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        _baseL = [BaseView new];
        [self.contentView addSubview:_baseL];
        _baseL.tag = 370;
        _baseR = [BaseView new];
        [self.contentView addSubview:_baseR];
        _baseR.tag = 380;
        
        _left = [UILabel new];
        [_baseL  addSubview:_left];
        
        _right = [UILabel new];
        [_baseR addSubview:_right];
        
        _dian = [UILabel new];
        [self.contentView addSubview:_dian];
        
        _label = [UILabel new];
        [self.contentView addSubview:_label];
        
        _sing = [SingletonStoreSimpleData shareViewController];
    }
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    return self;
}

-(void)layoutSubviews
{
    [super layoutSubviews];
    _label.frame = CGRectMake(10, self.frame.size.height/3, self.frame.size.width/3, self.frame.size.height/3);
    _label.textAlignment = 0;
    _label.font = [UIFont systemFontOfSize:14];
    
    _baseL.frame = CGRectMake(self.frame.size.width/3+20, self.frame.size.height/6 , self.frame.size.width/4, self.frame.size.height/3*2);
    _baseL.tag = 75;
    _baseL.backgroundColor = [UIColor yellowColor];
    //[_baseL addTarget:self selector:@selector(date:)];
    _left.frame = CGRectMake(0, 0, _baseL.frame.size.width, _baseL.frame.size.height);
    _left.font = [UIFont systemFontOfSize:13];
    _left.textAlignment = 1;
    _left.numberOfLines = 0;
    if (_sing.TheStartTime == nil) {
        _left.text = @"日期";
    }else{
        _left.text = _sing.TheStartTime;
    }
    //_left.alpha = 0.4;
    //_baseL.backgroundColor = [UIColor grayColor];
    _dian.frame = CGRectMake(self.frame.size.width/12*7+25, self.frame.size.height/4, 10, self.frame.size.height/2);
    _dian.text = @"-";
    
    _baseR.frame = CGRectMake(self.frame.size.width/12*7+40, self.frame.size.height/6, self.frame.size.width/4, self.frame.size.height/3*2);
    _baseR.tag = 76;
    _baseR.backgroundColor = [UIColor yellowColor];
    //[_baseR addTarget:self selector:@selector(date:)];
    _right.frame = CGRectMake(0, 0, _baseR.frame.size.width, _baseR.frame.size.height);
    _right.textAlignment  = 1;
    _right.numberOfLines = 0;
    _right.font = [UIFont systemFontOfSize:13];
    if (_sing.TheEndOfTime == nil) {
        _right.text = @"日期";
    }else{
        _right.text = _sing.TheEndOfTime;
    }
    //_right.alpha = 0.4;
    //_baseR.backgroundColor = [UIColor grayColor];
}





//如何在子视图中获取父视图的ViewController
- (UIViewController *)viewController{
    for (UIView *next = [self superview]; next; next = next.superview) {
        UIResponder *nextResponder = [next nextResponder];
        if ([nextResponder isKindOfClass:[UIViewController class]]) {
            return (UIViewController *)nextResponder;
        }
    }
    return nil;
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
